Skip to main content

Hold down a physical key (key.down)

The hardware keyboard behavior described on this page is available in versions after 20260805

Declaration​

key.down(keycode)

Parameters​

Description​

Simulate pressing down a physical key. Important: Without a global hardware keyboard, call the corresponding key.up afterwards. Otherwise the key may remain held even after the script ends. A global hardware keyboard releases all held keys when it is disconnected or the script stops.

  • After a global hardware keyboard is connected, standard keyboard and keypad keys use that object. Media and vendor-defined keys keep their previous behavior
  • This function remains paired with the matching key.up. If the hardware keyboard has already disconnected, the key was released during disconnection and the later key.up sends no input
  • Calls through key(...):down() follow the same rules

Example​

See the consolidated examples at the end of this chapter.